package com.zat.mes.andrmes.dofun.work.adapter

import android.media.Image
import android.text.TextUtils
import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zat.mes.andrmes.R
import com.zat.mes.andrmes.data.GetPackBean
import com.zat.mes.andrmes.data.MacCheckBean

/**
 * @author zy
 * @date :2020-02-22 09:28
 * @description: 机器检查列表
 */
class MacCheckListAdapter(layoutResId: Int) :
    BaseQuickAdapter<MacCheckBean, BaseViewHolder>(layoutResId), LoadMoreModule {

    override fun convert(helper: BaseViewHolder, item: MacCheckBean) {
        helper.setText(R.id.tvEmpNameMacCkList, "员工："+item?.empName)
        if (item?.shifts == "1") {
            helper.setText(R.id.tvShiftsMacCkList, "班次：白班")
        } else {
            helper.setText(R.id.tvShiftsMacCkList, "班次：晚班")
        }
        helper.setText(R.id.tvTimeSlotMacCkList, "时间段："+item?.timeSlot)
        helper.setText(R.id.tvMacNoCkList, "设备编码："+item?.machineNo)
        if (item?.brandChecker == "1") {
            helper.getView<ImageView>(R.id.ivBrandCkList).setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivBrandCkList).setImageResource(R.mipmap.ico_unselect)
        }
        if (item?.cylinderCheck == "1") {
            helper.getView<ImageView>(R.id.ivcyCheckDataCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivcyCheckDataCkList)
                .setImageResource(R.mipmap.ico_unselect)
        }
        if (item?.checkData == "1") {
            helper.getView<ImageView>(R.id.ivcyCheckDataCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivcyCheckDataCkList)
                .setImageResource(R.mipmap.ico_unselect)
        }
        if (item?.characters == "1") {
            helper.getView<ImageView>(R.id.ivCharacDataCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivCharacDataCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.checking == "1") {
            helper.getView<ImageView>(R.id.ivCheckingDataCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivCheckingDataCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }

    }
}